import { UserConfig, defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'

const config: UserConfig = {
	base: process.env.NODE_ENV === 'production' ? './' : '/',
	plugins: [
		vue(),
	],

	resolve: {
		alias: {
			'@': path.resolve(__dirname, './src'),
			'@/assets': path.resolve(__dirname, './src/assets')
		},
		extensions: ['.mjs', '.ejs', '.tsx', '.jsx', '.js', '.json', '.ts'], // 支持的自动文件扩展名
	},

	build: {
		outDir: path.resolve(__dirname, 'dist'),
		sourcemap: false,
		assetsInlineLimit: 4096,
		emptyOutDir: true, 
		chunkSizeWarningLimit: 1300,
		minify: 'terser',
		cssCodeSplit: true,
	},
}

export default defineConfig(config)
